import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: '/manage/homepage'
    },
    {
        path: '',
        // redirect: '/manage/system/tablelist'
        redirect: '/employee/foodmanage'
            // redirect: '/employee/indentemployee/historyorder'
            // redirect: '/manage/report/cashierwater'
    },
    {
        path: '/login',
        name: 'login',
        component: login
    },
    {
        path: '/employee',
        name: 'employee',
        component: () =>
            import ('../components/Employee.vue'),
        children: [{
                path: '/employee/indentemployee',
                name: 'indentemployee',
                component: () =>
                    import ('../views/employee/IndentEmployee.vue'),
                children: [{
                        path: '/employee/indentemployee/todayorder',
                        name: 'todayorder',
                        component: () =>
                            import ('../views/employee/TodayOrder.vue'),
                    },
                    {
                        path: '/employee/indentemployee/historyorder',
                        name: 'historyorder',
                        component: () =>
                            import ('../views/employee/HistoryOrder.vue')
                    },
                    {
                        path: '/employee/indentemployee/bookingorder',
                        name: 'bookingorder',
                        component: () =>
                            import ('../views/employee/BookingOrder.vue')
                    },
                    {
                        path: '/employee/indentemployee/numeralorder',
                        name: 'numeralorder',
                        component: () =>
                            import ('../views/employee/NumeralOrder.vue')
                    }
                ]
            },
            {
                path: '/employee/orderdetail',
                name: 'orderdetail',
                component: () =>
                    import ('../views/employee/OrderDetail.vue')
            },
            {
                path: '/employee/systememployee',
                name: 'systememployee',
                component: () =>
                    import ('../views/employee/SystemEmployee.vue'),
                children: [{
                        path: '/employee/systememployee/basic',
                        name: 'basic',
                        component: () =>
                            import ('../views/employee/Basic.vue')
                    },
                    {
                        path: '/employee/systememployee/personal',
                        name: 'personal',
                        component: () =>
                            import ('../views/employee/Personal.vue')
                    }
                ]
            },
            {
                path: '/employee/foodmanage',
                name: 'foodmanage',
                component: () =>
                    import ('../views/employee/FoodManage.vue')
            },
            {
                path: '/employee/homepageemployee',
                name: 'homepageemployee',
                component: () =>
                    import ('../views/employee/HomePageEmployee.vue')
            },
            {
                path: '/employee/order',
                name: 'order',
                component: () =>
                    import ('../views/employee/Order.vue')
            },
            {
                path: '/employee/single',
                name: 'single',
                component: () =>
                    import ('../views/employee/Single.vue')
            }, 
            {
                path: '/employee/table',
                name: 'table',
                component: () =>
                    import ('../views/employee/Table.vue')
            }
        ]
    },
    {
        path: '/manage',
        name: 'manage',
        component: () =>
            import ('../components/Manage.vue'),
        children: [{
                path: '/manage/homepage',
                name: 'homepage',
                component: () =>
                    import ('../views/manage/HomePage.vue')
            },
            {
                path: '/manage/food',
                name: 'food',
                component: () =>
                    import ('../views/manage/Food.vue')
            },
            {
                path: '/manage/inventory',
                name: 'inventory',
                component: () =>
                    import ('../views/manage/Inventory.vue'),
                children: [{
                        path: '/manage/inventory/foodstock',
                        name: 'foodstock',
                        component: () =>
                            import ('../views/manage/FoodStock.vue')
                    },
                    {
                        path: '/manage/inventory/stocktaking',
                        name: 'stocktaking',
                        component: () =>
                            import ('../views/manage/StockTaking.vue')
                    }
                ]
            },
            {
                path: '/manage/promotion',
                name: 'promotion',
                component: () =>
                    import ('../views/manage/Promotion.vue'),
                children: [{
                        path: '/manage/promotion/coupon',
                        name: 'coupon',
                        component: () =>
                            import ('../views/manage/Coupon.vue')
                    },
                    {
                        path: '/manage/promotion/product',
                        name: 'product',
                        component: () =>
                            import ('../views/manage/Product.vue')
                    }
                ]
            },
            {
                path: '/manage/indent',
                name: 'indent',
                component: () =>
                    import ('../views/manage/Indent.vue')
            },
            {
                path: '/manage/report',
                name: 'report',
                component: () =>
                    import ('../views/manage/Report.vue'),
                children: [{
                        path: '/manage/report/foodwater',
                        name: 'foodwater',
                        component: () =>
                            import ('../views/manage/FoodWater.vue')
                    },
                    {
                        path: '/manage/report/cashierwater',
                        name: 'cashierwater',
                        component: () =>
                            import ('../views/manage/CashierWater.vue')
                    },
                    {
                        path: '/manage/report/revenuereport',
                        name: 'revenuereport',
                        component: () =>
                            import ('../views/manage/RevenueReport.vue')
                    },
                    {
                        path: '/manage/report/smallprogram',
                        name: 'smallprogram',
                        component: () =>
                            import ('../views/manage/SmallProgram.vue')
                    }
                ]
            },
            {
                path: '/manage/system',
                name: 'system',
                component: () =>
                    import ('../views/manage/System.vue'),
                children: [{
                        path: '/manage/system/shop',
                        name: 'shop',
                        component: () =>
                            import ('../views/manage/Shop.vue'),
                        children: [{
                                path: '/manage/system/shop/worker',
                                name: 'worker',
                                component: () =>
                                    import ('../views/manage/Worker.vue')
                            },
                            {
                                path: '/manage/system/shop/store',
                                name: 'store',
                                component: () =>
                                    import ('../views/manage/Store.vue')
                            },
                            {
                                path: '/manage/system/shop/loginlog',
                                name: 'loginlog',
                                component: () =>
                                    import ('../views/manage/LoginLog.vue')
                            }
                        ]
                    },
                    {
                        path: '/manage/system/tablelist',
                        name: 'tablelist',
                        component: () =>
                            import ('../views/manage/TableList.vue')
                    },
                    {
                        path: '/manage/system/codeorder',
                        name: 'codeorder',
                        component: () =>
                            import ('../views/manage/CodeOrder.vue')
                    },
                    {
                        path: '/manage/system/pay',
                        name: 'pay',
                        component: () =>
                            import ('../views/manage/Pay.vue')
                    }
                ]
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router